$(function() {
	$("#img").click(function() {
		$(this).attr("src", "imageCode?r=" + parseInt(Math.random() * 1000));
	})
	$.post("selectListByOpenId", {
		activityType: '14',
	}, function(data) {
		/*mui.alert(JSON.stringify(data))*/
		var rel = data.data[0];
		$("#name").val(hb_null(rel.姓名))
		$("#tel").val(hb_null(rel.手机号))
		$("#yxhm").val(hb_null(rel.营销经理))
	})
	
	$("#tj").click(function() {
		var name = $("#name").val()
		if(name == "") {
			mui.alert("请输入您的姓名")
			return
		}
		var tel = $("#tel").val()
		if(tel == "") {
			mui.alert("请输入您的手机号")
			return
		}
		if(tel.length != 11) {
			mui.alert("请输入正确的手机号")
			return
		}
		tel = Base64.encode(tel)
		/*var sfzh = $("#sfzh").val()
		if(sfzh == "" && type == 1) {
			mui.alert("请输入您的身份证号")
			return
		}
		var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)|(^\d{17}(\d|X|x)(\d{2})$)/;
		if(reg.test(sfzh) === false && type == 1) {
			mui.alert("请输入正确的身份证号")
			return
		}
		sfzh = Base64.encode(sfzh)*/
		/*var code=$("#dxyzm").val()
		if(code==""){
			mui.alert("请输入短信验证码")
			return
		}*/
		var yxhm = $("#yxhm").val()
	/*	var shdz=$("#shdz").val()*/
		var senddata={
			name:name,
			tel:tel,
			number4:yxhm,
			activityType: '14',
			/*address:shdz,*/
		
		}
		mui.showLoading("正在加载..", "div")
		tjsj(senddata)
	})

})
var deptId = ''

function tjsj(senddata) {
	$.post("updateActivityUser", senddata, function(data) {
			/*alert(JSON.stringify(data))*/
		if(data.code==0) {
			mui.hideLoading();
			mui.alert("保存成功", function() {
				window.location.replace("wx_hblb")
			})
		} else {
			mui.hideLoading();
			mui.alert(data.msg)
		}
	})
}